﻿#include "mainwindow.h"

#include "DeviceLayer/Device.h"
#include "BusinessLayer/Containers.h"
#include <QApplication>
#include <QDebug>

using namespace DeviceLayer;

int main(int argc, char *argv[])
{
    BusinessLayer::ContainerForDevice::instance.CreateFromSettingData();
    BusinessLayer::ContainerForService::instance.CreateFromSettingData();

    qDebug() << BusinessLayer::ContainerForDevice::instance["clock"]->GetName();
    qDebug() << BusinessLayer::ContainerForDevice::instance["voltage"]->GetName();

    BusinessLayer::ContainerForDevice::instance.StartQueryDataThread();

    QApplication a(argc, argv);
    MainWindow w;
    w.show();

/*    qDebug() << GET_SETTING_STRING(Data);
    qDebug() << GET_SETTING_STRING(Devices/Device/Name);
    qDebug() << GET_SETTING_STRING(Devices/Device[0]/Name);
    qDebug() << GET_SETTING_STRING(Devices/Device[1]/Name);
    qDebug() << GET_SETTING_STRING(Devices/Device[2]/Name);
    qDebug() << GET_SETTING_STRING(Devices/Device::ClassName);
    qDebug() << GET_SETTING_STRING(Devices/Device/Class);

    SET_SETTING_STRING(Data, "abc");
    SET_SETTING_STRING(Devices/Device/Name, "测试");
    SET_SETTING_STRING(Devices/Device[1]/Class, "测试类");
    SET_SETTING_STRING(Devices/Device/Index, "5");
    SET_SETTING_STRING(Devices/Device/Name::encoding, "GB2312");
    SET_SETTING_STRING(Devices/Device::ClassName, "GB2313");

    QString className = GET_SETTING_STRING(Devices/Device[0]::class);
    std::shared_ptr<Object> a1 = ObjectFactory::CreateObj(className);
    className = GET_SETTING_STRING(Devices/Device[1]::class);
    std::shared_ptr<Object> b = ObjectFactory::CreateObj(className);
    qDebug() << a1->GetClassName();
    qDebug() << b->GetClassName();


    g_settingData.Save();
*/

    return a.exec();
}
